#ifndef HEAP_H_INCLUDED
#define HEAP_H_INCLUDED

typedef struct heap_t* Heap;

/**
 * Create and initialize a heap of the specified capacity
 * @param maxSize the initial capacity of the heap 
 * @return a new and initialized heap
 */
Heap Heap_Create(int capacity);

/**
 * Delete the Heap h
 * @param h the heap to delete
 */
void Heap_Delete(Heap h);

/**
 * Insert a new node with the secified values to the specified heap
 * @param h the heap on which the function will be executed
 * @param prio the priority of the node to insert
 * @param value the value of the node to insert
 */
void Heap_Insert(Heap h, int prio, int value);

/**	
 * Remove the root node of the heap h and returns its value
 * @param h The heap on which the function will be executed
 * @param error if not null, will contain 1 in case of success, 0 in case of failure (heap empty, etc...)
 * @return the value of the heap's root
 */
int Heap_Pop(Heap h, int *error, int *priority);

/**	
 * Return the value of the root node of the heap h
 * @param h The heap on which the function will be executed
 * @param error if not null, will contain 1 in case of success, 0 in case of failure (heap empty, etc...)
 * @return the value of the heap's root
 */
int Heap_GetMin(Heap h, int *error, int *priority);

/**	
 * Return the numer of elements currently in the heap.
 * @param h The heap on which the function will be executed
 * @return the numer of elements currently in the heap
 */
int Heap_GetSize(Heap h);

/**
 * For testing purposes: check if the heap is well oordered and display the errors if found
 * @param h the heap to perform the test on
 */
void Heap_Check(Heap h);


#endif
